<template>
  <div>
    <!-- 有数据 -->
    <div class="list" v-if="arr.length > 0">
      <van-card
        v-for="item in arr"
        :key="item.id"
        :price="item.price"
        :desc="item.goodsname"
        :thumb="$pre+item.img"
        @click="$router.push('/detail/' + item.id)"
      />
    </div>
    <!-- 无数据 -->
    <van-empty v-else description="暂无数据" />
  </div>
</template>

<script>
export default {
  props: ["arr"],
};
</script>

<style scoped>
.list {
  padding: 0.2rem;
}
.item {
  display: flex;
  background: #f4f4f4;
  margin: 0.2rem 0rem;
}
.item img {
  width: 1rem;
  height: 1rem;
}
.item .right {
  flex: 1;
  margin-left: 0.3rem;
}
.right h3 {
  font-size: 0.4rem;
  font-weight: 900;
}
</style>